<?php
defined('IN_TS') or die('Access Denied.');

//推荐课程
$arrRecommendStudys = $new['study']->findAll('study',array(
	'isrecommend'=>1,
),null,null,8);
foreach($arrRecommendStudys as $key=>$item){
    $arrRecommendStudy[$key] = $item;
    $arrRecommendStudy[$key]['studyname'] = cututf8($item['studyname'],0,20,false);
	$arrRecommendStudy[$key]['user'] = aac('user')->getOneUser($item['userid']);
}

//热门课程
$arrHotStudys = $new['study']->findAll('study',array(
	'isaudit'=>0,
),'count_learn desc',null,8);
foreach($arrHotStudys as $key=>$item){	
	$arrHotStudy[$key] = $item;
    $arrHotStudy[$key]['studyname'] = cututf8($item['studyname'],0,20,false);
	$arrHotStudy[$key]['user'] = aac('user')->getOneUser($item['userid']);
}

//最新课程
$arrNewStudys = $new['study']->findAll('study',array(
	'isaudit'=>0,
),'addtime desc',null,12);
foreach($arrNewStudys as $key=>$item){
    $arrNewStudy[$key] = $item;
    $arrNewStudy[$key]['studyname'] = cututf8($item['studyname'],0,20,false);
	$arrNewStudy[$key]['user'] = aac('user')->getOneUser($item['userid']);
}

$sitekey = $TS_APP['appkey'];
$sitedesc = $TS_APP['appdesc'];
$title = '课程';
include template("index");